home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
1333
/
1333.xpi
/
install.js
< prev
next >
Wrap
Text File
|
2010-02-14
|
3KB
|
79 lines
var XpiInstaller =
{
extFullName: 'Quick Locale Switcher', // The name displayed to the user (don't include the version)
extShortName: 'qls', // The leafname of the JAR file (without the .jar part)
extVersion: '1.7.0.1',
extAuthor: 'Martijn Kooij',
extLocaleNames: ['en-US', 'nl-NL', 'fr', 'it-IT', 'es-ES', 'de-DE', 'tr-TR', 'ko-KR', 'pl-PL', 'cs-CZ', 'bg-BG', 'pt-PT', 'sl-SI', 'zh-CN', 'sk-SK', 'ru-RU', 'fy-NL', 'zh-TW', 'pt-BR', 'da-DK', 'lt-LT', 'gl-ES', 'sq-AL', 'he-IL', 'en-GB', 'fa-IR', 'km-KH', 'uk-UA', 'hr-HR', 'be-BY', 'el-GR', 'vi-VN', 'ro-RO', 'es-AR', 'hu-HU', 'nb-NO', 'fi-FI', 'ca-AD', 'ar', 'ml-IN', 'wa-BE', 'is-IS', 'mk-MK', 'sr-RS', 'nn-NO', 'eo-EO', 'hsb-DE', 'dsb-DE', 'ja-JP'],
extSkinNames: ['classic'],
extPostInstallMessage: 'Success! Please restart your browser to finish the installation.', // Set to null for no post-install message
profileInstall: true,
silentInstall: false,
install: function()
{
var jarName = this.extShortName + '.jar';
var profileDir = Install.getFolder('Profile', 'chrome');
this.parseArguments();
if (File.exists(Install.getFolder(profileDir, jarName)))
{
if (!this.silentInstall) Install.alert('Updating existing Profile install of ' + this.extFullName + ' to version ' + this.extVersion + '.');
this.profileInstall = true;
}
else if (!this.silentInstall) this.profileInstall = Install.confirm('Install ' + this.extFullName + ' ' + this.extVersion + ' to your Profile directory (OK) or your Browser directory (Cancel)?');
var dispName = this.extFullName + ' ' + this.extVersion;
var regName = '/' + this.extAuthor + '/' + this.extShortName;
Install.initInstall(dispName, regName, this.extVersion);
var installPath;
if (this.profileInstall) installPath = profileDir;
else installPath = Install.getFolder('chrome');
Install.addFile(null, 'chrome/' + jarName, installPath, null);
var jarPath = Install.getFolder(installPath, jarName);
var installType = this.profileInstall ? Install.PROFILE_CHROME : Install.DELAYED_CHROME;
Install.registerChrome(Install.CONTENT | installType, jarPath, 'content/' + this.extShortName + '/');
var iLocale, iLen = this.extLocaleNames.length;
for (iLocale = 0; iLocale < iLen; iLocale ++)
{
var regPath = 'locale/' + this.extLocaleNames[iLocale] + '/';
Install.registerChrome(Install.LOCALE | installType, jarPath, regPath);
}
// Register skins
var iSkins, iSLen = this.extSkinNames.length;
for (iSkins = 0; iSkins < iSLen; iSkins ++)
{
var regPath = 'skin/' + this.extSkinNames[iSkins] + '/' + this.extShortName + '/';
Install.registerChrome(Install.SKIN | installType, jarPath, regPath);
}
var err = Install.performInstall();
if (err == Install.SUCCESS || err == Install.REBOOT_NEEDED)
{
if (!this.silentInstall && this.extPostInstallMessage) Install.alert(this.extPostInstallMessage);
}
else return this.handleError(err);
},
parseArguments: function()
{
var args = Install.arguments;
if (args == 'p=0')
{
this.profileInstall = false;
this.silentInstall = true;
}
else if (args == 'p=1') this.silentInstall = true;
},
handleError: function(err)
{
if (!this.silentInstall) Install.alert('Error: Could not install ' + this.extFullName + ' ' + this.extVersion + ' (Error code: ' + err + ')');
Install.cancelInstall(err);
}
};
XpiInstaller.install();